using GraphQL.Types;
using GraphQLDemo.Domain;

namespace GraphQLDemo.Api.GroupTypes;

public class ContractGraphType : ObjectGraphType<Contract>
{
    public ContractGraphType()
    {
        Name = "Contract";
        Description = "contract test ... ";

        Field(c => c.Name);
        Field<StringGraphType>("test")
            .Resolve(context =>
            {
                return "testttt";
            })
            .ApplyPortal(this, PortalType.Client);

        Field<ListGraphType<ContractItemGraphType>>("items")
            .Resolve(context =>
            {
                return new List<ContractItem>()
                {
                    new ContractItem(),
                    new ContractItem(),
                };
            });
    }
}